package com.gitee.cirnochat.chat.model.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;
import com.gitee.cirnochat.common.model.enums.BaseEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 消息响应状态
 * @author FlanChan
 * @since 2025-04-18 22:31:33
 */
@Getter
@AllArgsConstructor
public enum MessageResponseStatus implements BaseEnum<Integer> {
    // ====== 基础成功类 ======
    SUCCESS(0,  "成功"),
    PENDING(1,  "发送中"),

    // ====== 客户端错误类 ======
    INVALID_PARAM(1000,  "参数错误"),
    UNAUTHORIZED(1001, "未登录"),
    FORBIDDEN(1002, "无权限"),
    TOKEN_EXPIRED(1003, "Token 已过期"),
    USER_NOT_FOUND(1004, "用户不存在"),
    BLOCKED(1005,  "被拉黑"),
    STRANGER_CHAT_NOT_ALLOWED(1006,  "不允许陌生人聊天"),

    // ====== 消息相关错误 ======
    SESSION_NOT_FOUND(2000,  "会话不存在"),
    MESSAGE_RECALLED(2001,  "消息已撤回"),
    MESSAGE_BLOCKED(2002,  "消息因敏感词被屏蔽"),
    MESSAGE_DUPLICATE(2003,  "重复消息"),
    MESSAGE_TOO_LARGE(2004,  "消息体过大"),
    UNSUPPORTED_TYPE(2005,  "不支持的消息类型"),

    // ====== 系统或服务类错误 ======
    SERVER_ERROR(5000,  "服务器内部错误"),
    RATE_LIMITED(5001,  "发送过于频繁"),
    SERVICE_UNAVAILABLE(5002,  "服务不可用"),
    SERIALIZATION_ERROR(5003,  "消息序列化失败"),

    // ====== 系统通知类（非错误） ======
    SYSTEM_NOTICE(9000,  "系统通知"),
    MESSAGE_RECALLED_NOTIFY(9001,  "用户撤回了一条消息");

    @EnumValue // 用于 MyBatis-Plus 映射数据库值
    @JsonValue // 用于 JSON 序列化
    private final Integer value;

    private final String description;
}